package com.squirrel.common.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.squirrel.common.entity.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * CommentMapper 评论接口
 * </p>
 *
 * @author 关远键
 * @since 2021/11/11 16:06
 */
@Repository
public interface CommentMapper extends BaseMapper<Comment> {

    // 根据视频ID获取评论
    IPage<Comment> getCommentByVideoId(Page<Comment> page, @Param("videoId") Integer videoId, @Param("parentId") Integer parentId);

    List<Comment> getByParentId(@Param("videoId") Integer videoId, @Param("parentId") Integer parentId);

    IPage<Comment> getCommentByUserId(Page<Comment> page, @Param("userId") Integer userId);

}
